import type { DialogOptions, MessageType } from 'naive-ui'
import { createDiscreteApi } from 'naive-ui'

const { message, dialog } = createDiscreteApi(['message', 'dialog'])

export const IMessage = (content: string, type: MessageType = 'success') => {
  message.create(content, {
    type
  })
}

export const IConfirmMessage = ({
  content,
  onPositiveClick,
  onNegativeClick,
  title = '提示',
  type = 'info',
  positiveText = '确定',
  negativeText = '取消'
}: DialogOptions) => {
  dialog.create({
    content,
    onPositiveClick,
    onNegativeClick,
    title,
    type,
    positiveText,
    negativeText
  })
}
